// pages/book/book.js
import {BookModel} from "../../models/Book.js";
import {random} from "../../utils/common.js";

let bookModel = new BookModel();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    books:[],
    searching:false,
    more:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    bookModel.getHotList()
    .then(res=>{
      // console.log(res);
      this.setData({
        books:res,
      });
    })

  },

  onSearchTap:function(){
    // this.triggerEvent("sear");
    this.setData({
      searching:true,
    });
  },
  onCancel:function(){
    this.setData({
      searching:false,
    });
  },
  onReachBottom: function(event){
    // console.log(event);
    this.setData({
      more:random(16),
    });
  }

  
})